Socket
Socket
Sign inDemoInstall

static-extend

Package Overview
Dependencies
10
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    static-extend

Adds a static `extend` method to a class, to simplify inheritance. Extends the static properties, prototype properties, and descriptors from a `Parent` constructor onto `Child` constructors.


Version published
Maintainers
1
Install size
114 kB
Created

Package description

What is static-extend?

The static-extend npm package is used to easily extend the static properties and methods of a class. This is particularly useful in object-oriented programming where you might want to inherit or share static properties among multiple classes without affecting their instances directly.

What are static-extend's main functionalities?

Extending static methods and properties

This feature allows you to extend static methods and properties from one constructor function (or class) to another. In the provided code, the Child constructor inherits the static method 'foo' from the Parent constructor.

const staticExtend = require('static-extend');

function Parent() {}
Parent.foo = function() { return 'foo'; };

function Child() {}
staticExtend(Child, Parent);

console.log(Child.foo()); // Outputs: 'foo'

Other packages similar to static-extend

Keywords

FAQs

Last updated on 09 Jun 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc